package com.coin.exchange.otcbtc.api;

/**
 * OTCBTC Public Api
 * @author duyuchong
 *
 */
public interface OtcbtcPublicApi {

	/**
	 * Get all available markets.
	 * @return
	 * @throws Exception
	 */
	String getMarkets() throws Exception;

	/**
	 * Get ticker of all markets.
	 * @param marketId: If set, get ticker of specific market.
	 * @return
	 * @throws Exception
	 */
	String getTickers(String marketId) throws Exception;

	/**
	 * Get the order book of specified market.
	 * @param market(required): Unique market id.
	 * @param asksLimit: Limit the number of returned sell orders. Default to 20.
	 * @param bidsLimit: Limit the number of returned buy orders. Default to 20.
	 * @return
	 * @throws Exception
	 */
	String getOrderBook(String market, Integer asksLimit, Integer bidsLimit) throws Exception;

	/**
	 * Get recent trades on market, each trade is included only once. Trades are sorted in reverse creation order.
	 * @param market(required): Unique market id.
	 * @param limit: Limit the number of returned price levels. Default to 50.
	 * @param timestamp: An integer represents the seconds elapsed since Unix epoch. If set, only trades executed before the time will be returned.
	 * @param from: Trade id. If set, only trades created after the trade will be returned.
	 * @param to: Trade id. If set, only trades created before the trade will be returned.
	 * @param orderBy: If set, returned trades will be sorted in specific order, default to 'desc’.
	 * @return
	 * @throws Exception
	 */
	String getTrades(String market, Integer limit, Long timestamp, String from, String to, String orderBy) throws Exception;

	/**
	 * Get server current time, in seconds since Unix epoch.
	 * @return
	 * @throws Exception
	 */
	String getTimestamp() throws Exception;

	/**
	 * Get OHLC(k line) of specific market.
	 * @param market(required): Unique market id.
	 * @param limit: Limit the number of returned price levels. Default to 30.
	 * @param period: Time period of K line, default to 1. You can choose between 1, 5, 15, 30, 60, 120, 240, 360, 720, 1440, 4320, 10080. Default value : 1
	 * @param timestamp: An integer represents the seconds elapsed since Unix epoch. If set, only k-line data after that time will be returned.
	 * @return
	 * @throws Exception
	 */
	String getKlines(String market, Integer limit, Integer period, Long timestamp) throws Exception;

	/**
	 * Get K data with pending trades, which are the trades not included in K data yet, because there’s delay between trade generated and processed by K data generator.
	 * @param market(required): Unique market id.
	 * @param tradeId(required): The trade id of the first trade you received.
	 * @param limit: Limit the number of returned price levels. Default to 30.
	 * @param period: Time period of K line, default to 1. You can choose between 1, 5, 15, 30, 60, 120, 240, 360, 720, 1440, 4320, 10080. Default value : 1
	 * @param timestamp: An integer represents the seconds elapsed since Unix epoch. If set, only k-line data after that time will be returned.
	 * @return
	 * @throws Exception
	 */
	String getKlinesWithPendingTrades(String market, String tradeId, Integer limit, Integer period, Long timestamp) throws Exception;

}
